#ifndef _GOMOKU_H_
# define _GOMOKU_H_

# include <string>
# include "ThreadManager.h"
# include "Board.h"
# include "Arbiter.h"

class Gomoku
{
public:
	struct Player
	{
		std::string Name;
		int EnnemyPiecesCount;
		BoardCase Color;
		bool Winner;

		Player()
		: Name(""), EnnemyPiecesCount(0), Color(COLOR_NONE), Winner(false)
		{
		}

		Player(std::string const& _name, BoardCase _color)
		: Name(_name), EnnemyPiecesCount(0), Color(_color), Winner(false)
		{
		}

		~Player()
		{
		}
	};

private:
	static Gomoku& m_instance;
	Board m_board;
	ThreadManager* m_threadManager;
	bool m_ruleThreeUse;
	Arbiter m_arbiter;
	Player m_players[2];
	Player* m_currentPlayer;

private:
	Gomoku();
	~Gomoku();

public:
	static Gomoku& Instance();

	void nextPlayerTurn();

	void setRuleThreeUse(bool _value);

	Board& getBoard();
	bool getRuleThreeUse() const;
	Arbiter& getArbiter();
	Player* getCurrentPlayer();
	Player* getPlayers();
	void setCurrentPlayer(Player* _player);
	ThreadManager* getThreadManager();
	void reset();

public:
	__declspec(property(get=getBoard))Board Board;
	__declspec(property(get=getRuleThreeUse, put=setRuleThreeUse))bool RuleThreeUse;
	__declspec(property(get=getArbiter))Arbiter Arbiter;
	__declspec(property(get=getCurrentPlayer, put=setCurrentPlayer))Player* CurrentPlayer;
	__declspec(property(get=getThreadManager))ThreadManager* Threads;

private:
	Gomoku(Gomoku const&);
	Gomoku& operator=(Gomoku const&);
};

#endif // _GOMOKU_H_
